<?php
/**
 * Created by PhpStorm.
 * User: liuxiaojie
 * Date: 2019-06-18
 * Time: 16:09
 */

namespace app\mall\controller;

use app\common\Base;
use app\mall\service\GoodsService;
use think\Request;

class Goods extends Base
{
    private $goodsService;
    function __construct(Request $request = null, GoodsService $goodsService)
    {
        parent::__construct($request);
        $this->goodsService = $goodsService;
    }

    function lists()
    {
        $param = [

        ];
        $customer_id = $this->getParam('u_id', 0);

        $data = $this->goodsService->lists($param, $this->pageSize, $customer_id);
        return success($data);
    }

    function lists2()
    {
        $param = [

        ];
        $customer_id = $this->getParam('u_id', 0);

        $data = $this->goodsService->lists2($param, $customer_id);
        return success($data);
    }

    function lists3()
    {
        $param = [
            'category_id'=> $this->getParam('category_id', 0)
        ];
        $customer_id = $this->getParam('u_id', 0);

        $data = $this->goodsService->lists3($param, $this->pageSize, $customer_id);
        return success($data);
    }

    function detail()
    {
        $param = [
            'goods_id'=> $this->getParam('goods_id', 0)
        ];

        $customer_id = $this->getParam('u_id', 0);
        $data = $this->goodsService->detail($param, $customer_id);
        return success($data);
    }

    function recommend()
    {
        $param = [
            'goods_id'=> $this->getParam('goods_id')
        ];

        $customer_id = $this->getParam('u_id', 0);
        $data = $this->goodsService->recommend($param, $this->pageSize, $customer_id);
        return success($data);
    }

    function customer()
    {
        $param = [
            'goods_id'=> $this->getParam('goods_id', 0)
        ];
        $data = $this->goodsService->customerList($param);
        return success($data);
    }

}